VMS Help  —  PASCAL  Data Types, Schema Types
  A schema type  is  a  user-defined  construct  that  provides  a
  template  for  a  family  of distinct data types.  A schema type
  definition contains one or more formal discriminants  that  take
  the   place   of  specific  boundary  values  or  variant-record
  selectors.  By specifying  boundary  or  selector  values  to  a
  schema  type,  you form a valid data type; the provided boundary
  or selector values are called actual discriminants.

  Syntax:

     schema-identifier
        ({discriminant-identifier},... : [[attribute-list]]
          ordinal-type-name};...) = [[attribute-list]] type-denoter;

  The 'schema-identifier' is the name of the schema.

  The  'discriminant-identifier'  is  the   name   of   a   formal
  discriminant.

  The 'ordinal-type-name' is the type of the formal  discriminant,
  which must be an ordinal type.

  The 'attribute-list' is one or  more  identifiers  that  provide
  additional information about the type-denoter.

  The 'type-denoter' is the type definition of the  components  of
  the  schema.   This  must  define  a  new record, array, set, or
  subrange type.

  Each schema type definition requires at least  one  discriminant
  identifier.   A discriminant identifier does not have to be used
  in the type-denoter definition, but it is used to determine type
  compatibility.   Discriminant  identifiers can appear anywhere a
  value is required in this definition.

  TYPE
     Array_Template( Upper_Bound : INTEGER )

  The identifier Upper_Bound is the  formal  discriminant  of  the
  Array_Template  schema.   The  Array_Template  schema  is  not a
  complete description of data.  It is not a valid data type until
  you  provide  an  actual  discriminant that designates the upper
  boundary of the array template.

  Actual   discriminants   can   be   compile-time   or   run-time
  expressions.  This expression must be assignment compatible with
  the ordinal type specified for the formal  discriminant.   Also,
  the actual discriminant value must be inside the range specified
  for the formal discriminant; in the case of subranges, the upper
  value must be greater than or equal to the lower value.

1  –  Discriminated Schema

  A discriminated schema is a schema type that has  been  provided
  actual discriminants.  Discriminated schema can appear in either
  the TYPE or the VAR sections.  For example:

  TYPE
     Array_Template( Upper_Bound : INTEGER )
  VAR
     Array_Type1 : Array_Template( 10 );  {ARRAY [1..10] OF INTEGER;}
     Array_Type2 : Array_Template( x );   {Upper boundary determined
                                           at run-time by variable or
                                           function call}

  In this example, the actual discriminants 10 and x complete  the
  boundaries  for  Array_Template, forming two complete data types
  within  the  same  schema  type  family.   The  type  specifiers
  Array_Template(  10  )  and  Array_Template( x ) are examples of
  discriminated schema.

2  –  Undiscriminated Schema

  An undiscriminated schema is a schema type  that  has  not  been
  provided  actual  discriminants.  You can use an undiscriminated
  schema as the domain type of a pointer  or  as  the  type  of  a
  formal parameter.  For example:

  TYPE
     Ptr_to_Array_Template = ^Array_Template;
     Array_Template( Upper_Bound : INTEGER )

  The Array_Template schema is not a complete description of data.
  It  is  not  a  valid  data  type  until  you  provide an actual
  discriminant that designates the upper  boundary  of  the  array
  template.
Close Help